#ifndef BTN_H
#define BTN_H

#include <QObject>
#include <QGraphicsPixmapItem>
#include <QGraphicsSceneMouseEvent>

class Btn : public QObject,public QGraphicsPixmapItem
{
    Q_OBJECT
public:
    explicit Btn(const QPixmap& pixmap, QGraphicsItem* parent = nullptr);
    // 启用悬停事件
    void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
    void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;

    // 鼠标点击事件
    void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
    //void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
    // 保存原始图像

    //void updateAppearance(bool pressed = false); // 更新按钮外观
signals:
    void clicked(); // 点击信号
private:
    QPixmap m_originalPixmap;
};

#endif // BTN_H
